﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="eleorderlist.aspx.cs" Inherits="shop_eleorderlist" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<%@ Register Src="~/Banner.ascx" TagPrefix="top" TagName="banner" %>
<%@ Register Src="~/header.ascx" TagName="banner" TagPrefix="uc1" %>
<%@ Register Src="~/Foot.ascx" TagPrefix="foot" TagName="foot" %>
<%@ Register Src="~/shop/Left.ascx" TagName="LeftBanner" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>饿了么订单-<%= SectionProxyData.GetSetValue(3)%></title>

    <link rel="stylesheet" type="text/css" href="/user/css/user_center.css" />
    <link href="/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/user/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/user/css/userinfo.css" rel="stylesheet" />


    <script src="../JavaScript/jquery-1.3.2.js" type="text/javascript"></script>
    <script src="../JavaScript/ShowDivDialog.js" type="text/javascript"></script>
    <script src="DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="js/soundmanager2.js" type="text/javascript"></script>


    <script language="javascript" type="text/javascript">


        $(document).ready(function () {
            delayURL();
        });

        function delayURL() {
            var timebox = $("#time");
            var delay = parseInt(timebox.html());
            if (delay > 0) {
                delay--;
                timebox.html(delay + "");
            }
            setTimeout(delayURL, 1000);
        }

        soundManager.debugMode = false;
        soundManager.debugFlash = false;
        soundManager.url = "soundmanager2.swf";

        function play(flag) {
            $("#time").html(30);
            if (flag == 0) {
                return;
            }
            var v = document.getElementById("cbSound").checked;
            if (v == true) {
              //  soundManager.play('mySound1', 'notify.mp3');
            }
        }


        function Soundclike() {
            var soundflag = document.getElementById("cbSound").checked; //true表示有，false 表示没有
            handlecookie("sound", soundflag, { expires: 1, path: "/", secure: false });

        }

        function cookeiinit() {
            var sound = handlecookie("sound");
            document.getElementById("cbSound").checked = sound;
        }

        function ordernavinit() {
            var re = request("id");

        }
        $(document).ready(function () {
            initshopnav(3);
            ordernavinit();
        })

    </script>

</head>
<body>
    <form id="form1" runat="server">
        <top:banner ID="Banner1" runat="server" />
        <uc1:banner ID="Banner2" runat="server" />
        <div class="shop_containner clearfix">
            <uc2:LeftBanner runat="server" ID="Left" />
            <div class="shop_main">
                <div class="main-content">
                    <div class="shop_menu">
                        <ul>
                            <li id="all"><a href="OrderList.aspx">我的订单</a></li>

                            <li runat="server" id="elebox" style="display: none;" class="cur"><a href="eleorderlist.aspx">饿了么订单</a></li>


                              <li  runat="server" id="mtbox" style="display:none;"><a href="mtorderlist.aspx?type=10">美团订单</a></li>


                        </ul>
                    </div>
                    <div class="listorder" style="width: 795px;">

                        <ul>

                            <li>



                                <table border="0" cellpadding="0" cellspacing="0" style="margin-left: 10px; float: left"
                                    class="condition_table">
                                    <tr>
                                        <td align="right">
                                            <span style="width: 160px;">订单编号：</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tborderid" runat="server" CssClass="j_text" Width="100px" />
                                        </td>
                                    </tr>



                                    <tr>
                                        <td align="right">
                                            <span class="span12" style="width: 160px;">状态：</span>
                                        </td>
                                        <td>


                                            <asp:DropDownList runat="server" ID="ddlOrderState" Style="width: 80px;" AppendDataBoundItems="true">
                                                <asp:ListItem Text="所有订单" Value="-1"></asp:ListItem>
                                            </asp:DropDownList>


                                            <asp:DropDownList runat="server" ID="ddlIsShopSet" class="j_select">
                                                <asp:ListItem Text="商户处理状态" Value="-1"></asp:ListItem>
                                                <asp:ListItem Text="未发" Value="0"></asp:ListItem>
                                                <asp:ListItem Text="已发" Value="1"></asp:ListItem>

                                            </asp:DropDownList>


                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <span style="width: 160px;">地址：</span>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="tbAddressText" runat="server" CssClass="j_text" Width="100px" />
                                        </td>
                                    </tr>
                                </table>

                                <table border="0" cellpadding="0" cellspacing="0" style="margin-left: 10px; float: left"
                                    class="condition_table">


                                    <tr>
                                        <td align="right">
                                            <span style="width: 160px;">收货人：</span>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="tbOrderRcver" CssClass="j_text" Width="100px" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <span style="width: 160px;">收货人电话：</span>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="tbphone" CssClass="j_text" Width="100px" />
                                        </td>
                                    </tr>





                                </table>
                                <table border="0" cellpadding="0" cellspacing="0" style="margin-left: 10px; float: left"
                                    class="condition_table">
                                    <tr>
                                        <td align="right">
                                            <span class="span12" style="width: 160px;">订单时间：</span>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" CssClass="inputclass" ID="tbStartTime" onfocus="WdatePicker({readOnly:true})"
                                                Width="80"></asp:TextBox>
                                            <asp:Label runat="server" ID="lbTemp" Text="至"></asp:Label>
                                            <asp:TextBox runat="server" ID="tbEndTime" CssClass="inputclass" onfocus="WdatePicker({readOnly:true})"
                                                Width="80"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <span style="width: 160px;">备注：</span>
                                        </td>
                                        <td>
                                            <asp:TextBox runat="server" ID="tbOrderAttach" CssClass="j_text" Width="100px" />
                                        </td>
                                    </tr>




                                </table>


                            </li>



                        </ul>

                        <div class=" clear"></div>
                        <div style="margin-top: 20px;">

                            <asp:Button ID="btSearch" runat="server" Text="查询" CssClass="subBtn" OnClick="settime_Click" />


                        </div>


                        <div class="clear"></div>
                        <fieldset class="AdminSearchform">
                            <legend>统计</legend>
                            <div style="clear: both; padding: 10px;">

                                <div style="display:none;">
                                <input type="checkbox" id="cbSound" onclick="Soundclike()" /><label for="cbSound">声音提醒</label>
                                </div>

                                <span style="margin-left: 20px;">
                                    <label id="time">
                                        30</label>秒后自动刷新。
                                    <asp:Button runat="server" ID="tbnew" CssClass="btnew" Text="手动刷新" OnClick="Timer1_Tick" /></span>




                            </div>
                        </fieldset>


                    </div>
                    <div class="clear"></div>

                    <asp:ScriptManager ID="ScriptManager1" runat="server">
                    </asp:ScriptManager>

                    <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="30000">
                    </asp:Timer>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                        </Triggers>

                        <ContentTemplate>
                            <div class="usermima">
                                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="listorder_table"
                                    style="border: 1px solid #ccc;">
                                    <asp:Repeater ID="rptOrderList" runat="server" OnItemCommand="rptOrderList_ItemCommand">
                                        <HeaderTemplate>
                                            <tr>
                                                <th style="width: 10%">订单编号
                                                </th>

                                                <th style="width: 12%">时间
                                                </th>


                                                <th style="width: 4%">距离
                                                </th>

                                                <th style="width: 6%">配送费
                                                </th>

                                                <th style="width: 4%">金额
                                                </th>






                                                <th style="width: 10%">状态
                                                </th>

                                                <th style="border-right: 0; width: 8%">操作
                                                </th>

                                            </tr>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <tr>
                                                <td>
                                                    <a href="OrderDetail.aspx?id=<%#Eval("unid")%>" target="_blank"><%#Eval("OrderID")%></a>
                                                </td>

                                                <td>
                                                    <%# Eval("OrderDateTime")%>
                                                </td>
                                                <td>
                                                    <%#Eval("cardpay")%>
                                                </td>
                                                <td>
                                                    <%# Eval("shopdiscountmoney")%>
                                                   
                                                </td>

                                                <td>
                                                    <%# Eval("OrderSums")%>
                                                </td>



                                                <td>
                                                    <span  id="order_<%# Eval("orderid") %>">
                                                        <%# Convert.ToInt32(Eval("IsShopSet")) == 0 ? "未发" :"已发"  %>
                                                    </span>

                                                </td>
                                                <td>


                                                    <input type="button" id="btsubmit_<%# Eval("orderid") %>" value="发送" onclick="sendEleOrder2system('<%# Eval("orderid") %> ')" class="subBtn" data-ajax="false" style="<%# Convert.ToInt32(Eval("IsShopSet")) == 0? "": "display:none;"  %>" />



                                                </td>


                                            </tr>
                                            <tr>
                                                <td colspan="3" style="text-align: left;">
                                                    <div style="line-height: 24px;">

                                                        <div>收货人:<%#Eval("OrderRcver")%>/<%#Eval("OrderComm")%></div>
                                                        <div>约定:<%# Eval("SendTime")%></div>



                                                    </div>
                                                </td>

                                                <td colspan="4" style="text-align: left;">
                                                    <div style="line-height: 24px;">
                                                        <div>备注:<%# Eval("OrderAttach")%></div>
                                                        <div>地址:<%#Eval("AddressText")%></div>

                                                    </div>


                                                </td>




                                            </tr>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <tr>
                                            </tr>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                </table>
                            </div>
                            <div id="noRecord" runat="server" class="no_infor">
                                暂无订单！
                            </div>
                            <div class="pages">
                                <webdiyer:AspNetPager CssClass="anpager" ID="AspNetPager1" runat="server" Width="100%"
                                    CustomInfoHTML="共有记录 <font>%RecordCount%</font> 条 当前为 <font>%CurrentPageIndex%</font>/<font>%PageCount%</font> 页"
                                    HorizontalAlign="Right" ShowCustomInfoSection="Left" CustomInfoTextAlign="Right"
                                    CustomInfoSectionWidth="28%" ShowPageIndexBox="Always" PageIndexBoxType="TextBox"
                                    TextBeforePageIndexBox="转到 " OnPageChanged="AspNetPager1_PageChanged" PageIndexBoxClass="flattext"
                                    ShowPageIndex="True" PageSize="10" SubmitButtonClass="flatbutton" SubmitButtonText=" GO "
                                    TextAfterPageIndexBox=" 页 " Wrap="False" FirstPageText="首页" LastPageText="尾页"
                                    NextPageText="下一页" PrevPageText="上一页">
                                </webdiyer:AspNetPager>
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </div>
        </div>
        <foot:foot runat="server" ID="foot" />
    </form>
</body>
</html>
<script type="text/javascript">

    ///发送饿了么订单到系统
    function sendEleOrder2system(orderid) {

        showload_super();

        jQuery.ajax(
        {
            type: "get",
            url: "/ajaxHandler.ashx",
            data: 'method=sendEleOrder2system&orderid=' + orderid + "&t=" + new Date().getTime(),
            success: function (msg) {
              
                hideload_super();

                var json = JSON.parse(msg);
                if (json.state ==1) {
                    alert("发送成功");
                    $("#order_"+orderid).html("已发");
                    $("#btsubmit_"+orderid).hide();
                }
                else
                {
                    alert(json.msg);
                 
                }


            }
        });
    }


</script>
